aregmi.net
Resume

Learn how to curl with certificate auth

How to curl with client cert

Step 1: Create PFX from crt + key

& "C:\Program Files\Git\usr\bin\openssl.exe" pkcs12 -export `
  -out "C:\Users\secureapi-prod.pfx" `
  -in "C:\Users\securecert.crt" `
  -inkey "C:\Users\securekey.key"

Type a password like changeit when prompted.

Step 2: Import PFX into Windows cert store

Import-PfxCertificate -FilePath "C:\Users\secureapi-prod.pfx" -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String "changeit" -AsPlainText -Force)

Step 3: Curl using thumbprint

$thumb = (Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Subject -like "*securecert*" }).Thumbprint
curl.exe -v -L `
  --proxy http://yourproxy.com:port `
  --cert "CurrentUser\My\$thumb" `
  -X POST `
  -H "Content-Type: application/json" `
  -d "{}" `
  "https://aregmi.net/ask"